package pkg

import (
	"demo_bff/user_proto"
	_ "github.com/mbobakov/grpc-consul-resolver"
	"google.golang.org/grpc"
	"log"
)

func Comment() user_proto.UserClient {
	conn, err := grpc.Dial(
		"consul://127.0.0.1:8500/user_srv?wait=14s",
		grpc.WithInsecure(),
		grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy": "round_robin"}`),
	)
	if err != nil {
		log.Fatal(err)
	}
	client := user_proto.NewUserClient(conn)
	return client
}
